﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;

namespace MG_POS_PC
{
    public partial class WaitingBox : BaseForm
    {
        private Thread tWait = null;
        public WaitingBox()
        {
            InitializeComponent();
            this.tWait = new Thread(new System.Threading.ParameterizedThreadStart(showWaitDlg));
            this.tWait.Name = "waiting thread";
            this.StartPosition = FormStartPosition.CenterScreen;

            
        }

        public void ShowMsg(string msg)
        {
            this.tWait.Start(msg);
        }

        public void CloseMsg()
        {
            if (this.tWait.ThreadState == System.Threading.ThreadState.Running)
            {
                this.tWait.Abort();
            }
        }

        private void showWaitDlg(object msg)
        {
            this.lblMsg.Text = msg.ToString();
            this.ShowDialog();
        }
       
    }
}
